const gFunc = {
    switchTypeChinse(type){
        let name = ''
            switch (type) {
                case 'TISU':
                    name = '缇苏项目'
                    break;
                case 'TRIPARTITE':
                    name = '外部第三方项目'
                    break;
                case 'INTERIOR':
                    name = '内部项目'
                    break;
                case 'STUDY':
                    name = '研究学习项目'
                    break;
                case 'WAITING':
                    name = '待进行'
                    break;
                case 'ONGOING':
                    name = '进行中'
                    break;
                case 'FINISH':
                    name = '已完成'
                    break;
                case 'CANCEL':
                    name = '已取消'
                    break;                                                                    
                default:
                    break;
            }
        return name
    },
    ifPermissionsMenu(name, permissions){
        
        // if (name === 'login') {
        //     return true
        // }
        let _obj = {
            "dashboard": "manage_homepage_dashboard",
            "project" : "manage_projects",
            "staffPaper": "manage_staff_reports",
            "managePaper": "manage_manager_reports",
            "members": "manage_members",
            "roles": "manage_roles_api",
            "dailyPaper": "manage_all_reports"
        }
        let flag = _obj[name] 
                ? permissions
                    ? permissions[_obj[name]] 
                        ? true
                        : false
                    : false
                : false 
        return flag
        // return false
    },
    pathArray(pathString){
        return pathString.split('/').filter((item => item && item.trim()))
    }
}

export {gFunc}